package Undefinied;

import java.util.ArrayList;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;

public class Editberreich extends Anzeigbar {
	public int ausgewhlt=1;
	public ArrayList <Layer> Liste=new ArrayList <Layer>();
	
	Editberreich(float x, float y){
		this.XPos=x;
		this.YPos=y;
	}

	public void add(){
		Liste.add(new Layer(){
    		public void mousePressed(int button, int x, int y) {
    			if(button==0){
    				Array[x/16][y/16]=(Array[x/16][y/16]+1) %4;
    				remaster();
    			}
    			if(button==2){
    				Array[x/16][y/16]=(Array[x/16][y/16]+1) %4;
    				remaster();
    			}
    		}
    	});
	}
	
	public void mousePressed(int button, int x, int y) {
		Liste.get(ausgewhlt).mousePressed(button, x, y);
	}

	public void init(GameContainer gc, StateBasedGame sbg) {
		for (Layer entry : Liste) {
			entry.init(gc,sbg);
		}
		
	}

	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) {
		g.translate(XPos, YPos);
		g.draw(new Rectangle(0,0, 15,15));
		for (Layer entry : Liste) {
			entry.render(gc,sbg,g);
		}
		g.resetTransform();
		
	}

	public void update(GameContainer container, StateBasedGame sbg, int delta) {
		for (Layer entry : Liste) {
			entry.update(container,sbg,delta);
		}
	}
}
